<template>
    <div class="card">
        <!-- {{this.cardData}} -->
        <div class="block">
            <div v-if="this.cardData == ''" class="noEquipment"> 
                该项绑定设备未开启
            </div>
            <el-carousel trigger="click" class="card_hight" :autoplay="false" :initial-index="cardData.index" >
            <el-carousel-item v-for="item in cardData.unit" :key="item.index">
                <!-- 设备标题 -->
                <router-link to="/overview">
                    <h4 class="normal" @click="router('cleanbox',item)" :title="item.name">
                    <!-- <svg class="icon card_icon" aria-hidden="true">
                        <use xlink:href="#icon-xinfeng-copy"></use>
                    </svg> -->
                    <img class="title_icon" src="../../assets/title.png" alt />
                    {{item.typename}}:&nbsp;{{item.name}}
                 </h4>
                </router-link>
                <!-- 卡片内容 -->
                <div class="card_padding">
                    <div class="cleanbox_left">
                        <div class="cleanbox_pm">
                            <p class="cleanbox_pm_name">
                                <svg class="icon card_icon" aria-hidden="true">
                                    <use xlink:href="#icon-PM"></use>
                                </svg>
                                <span class="cleanbox_pm_title">{{item.unit[2].name}}</span>
                            </p>
                            <p class="cleanbox_pm_val">{{item.unit[2].value.toFixed(0)}}</p>
                            <p class="cleanbox_pm_flag">{{item.unit[2].flag}}</p>
                            <!-- <p class="cleanbox_pm_name">PM2.5</p> -->
                        </div>
                        <div class="cleanbox_pm">
                            <p class="cleanbox_pm_name">
                                <svg class="icon card_icon" aria-hidden="true">
                                    <use xlink:href="#icon-PM"></use>
                                </svg>
                                <span class="cleanbox_pm_title">{{item.unit[3].name}}</span>
                            </p>
                            <p class="cleanbox_pm_val">{{item.unit[3].value.toFixed(0)}}</p>
                            <p class="cleanbox_pm_flag">{{item.unit[3].flag}}</p>
                        </div>
                        <div class="cleanbox_pm">
                            <p class="cleanbox_pm_name">
                                <svg class="icon card_icon" aria-hidden="true">
                                    <use xlink:href="#icon-tvoc"></use>
                                </svg>
                                <span class="cleanbox_pm_title">{{item.unit[0].name}}</span>
                            </p>
                            <p class="cleanbox_pm_val">{{item.unit[0].value.toFixed(0)}}</p>
                            <p class="cleanbox_pm_flag">{{item.unit[0].flag}}</p>
                        </div>
                        <div class="cleanbox_pm">
                            <p class="cleanbox_pm_name">
                                <svg class="icon card_icon" aria-hidden="true">
                                    <use xlink:href="#icon-app_icons---copy"></use>
                                </svg>
                                <span class="cleanbox_pm_title">{{item.unit[1].name}}</span>
                            </p>
                            <p class="cleanbox_pm_val">{{item.unit[1].value.toFixed(0)}}</p>
                            <p class="cleanbox_pm_flag">{{item.unit[1].flag}}</p>
                        </div>
                    </div>
                    <div class="cleanbox_right">
                        <div class="cleanbox_circle">
                            <p style="color:#bbbbbb" v-if="item.unit[4].value == 16 || item.unit[4].value == 0">待净化</p>
                            <p style="color:#49d1ff" v-if="item.unit[4].value == 17">强效净化</p>
                            <p style="color:#49d1ff" v-if="item.unit[4].value == 33">快速净化</p>
                            <p>上柜</p>
                        </div>

                        <div class="cleanbox_circle">
                            <p style="color:#bbbbbb" v-if="item.unit[5].value == 16 || item.unit[5].value == 0">待净化</p>
                            <p style="color:#49d1ff" v-if="item.unit[5].value == 17">强效净化</p>
                            <p style="color:#49d1ff" v-if="item.unit[5].value == 33">快速净化</p>
                            <p>下柜</p>
                        </div>  
                    </div>
                </div>
                 
            </el-carousel-item>
            </el-carousel>
        </div>
        
    </div>
</template>

<script>
export default {
    props: ['nowIndex', 'cardData', 'nowId'],
    data () {
        return{
        }
    },
    created() {
    },
    methods: {
        // 跳转
        router(val,item){
            var arr = {
                addr:item.addr,
                name:item.name,
                type:item.type,
                uid:item.uid
            }
            localStorage.setItem("当前设备编号", JSON.stringify(arr))
            localStorage.setItem("menuRouter", val)
        },
    },
     // 清除定时器
    beforeDestroy() {
    },
}
</script>

<style scoped>

/deep/ .el-carousel__container .el-carousel__arrow {
    height: 150px !important;
    width: 110px !important;
    border-radius: 0;
    background: none;
}
/deep/ .el-icon-arrow-left {
    margin-left: -110px !important;
}
/deep/ .el-icon-arrow-right{
    margin-right: -110px !important;
}
/deep/ .el-carousel__indicators{
    display: none;
}
.normal .card_icon{
    font-size: 20px;
}
/deep/ .card_padding {
    padding: 5px 20px 0px 30px !important;
    display: flex;
}
.cleanbox_left{
    width: 60%;
}
.cleanbox_pm{
    height: 46px;
    margin: 10px 0px;
    padding: 4px 0px 4px 5px;
    text-align: center;
    border-left: 5px solid #8fc6ff8f;
    background: linear-gradient(to left , rgba(255, 0, 0, 0), #8fc6ffa3,#8fc6ffa3 500%);
    display: flex;
}
.cleanbox_pm:first-child{
    margin-top: 0px;
}
/* .cleanbox_pm_name{
    margin-top: 10px;
} */
.cleanbox_pm_name{
    width: 50px;
}
.cleanbox_pm .icon{
    font-size: 25px;
}
.cleanbox_pm:first-child .icon{
    font-size: 25px;
}
.cleanbox_pm:nth-child(3) .icon{
    font-size: 23px;
}
.cleanbox_pm:nth-child(4) .cleanbox_pm_title{
    position: relative;
    top: -2px;
}
.cleanbox_pm_val{
    width: 90px;
    font-size: 27px;
    line-height: 47px;
    color: #38bdea;
    margin-right: 10px;
    margin-left: 5px;
    overflow: hidden;
}
.cleanbox_pm_title{
    color: #fff !important;
    font-size: 13px;
    display: block;
}
.cleanbox_pm_flag{
    color: #acacac;
    line-height: 46px;
}
/* .center{
    margin-top: 15px;
}
.airclean_progress{
    display: flex;
    margin-bottom: 20px;
    width: 268px;
    overflow: hidden;
}
.airclean_progress p{
    width: 50px;
    overflow: hidden;
    line-height: 20px;
    color: #00f3ff;
    font-size: 15px;
}
/deep/ .el-progress-bar__inner{
 background-color: transparent !important;
 background-image: linear-gradient(to right,#15ace6,#a8d5f6d9);
    background-size: 100% 100%;}
/deep/ .progress_title {
    width: 130px;
    line-height: 24px;
    float: left;
    font-size: 16px;

}
/deep/ .el-progress{
    padding: 4px 0;
    padding-right: 10px;
    width: 200px;
}
/deep/ .el-progress-bar__outer{
    background: none;
    border: .5px solid rgba(89, 129, 165, 0.8);
} */
.cleanbox_right{
    flex: 1;
}
.cleanbox_circle{
    width: 104px;
    height: 115px;
    background:url("../../assets/circle1.png") no-repeat;
    background-size: 100% auto;
    text-align: center;
    font-size: 18px;
    position: relative;
    left: 10px;
}
.cleanbox_circle:nth-child(2){
    bottom: 3px;
}
.cleanbox_circle p:first-child{
    margin: 0 auto;
    padding-top: 33px;
    padding-bottom: 2px;
    width: 79px;
}
.cleanbox_circle p:last-child{
    font-size: 15px;
    padding-top: 4px;
}
/* .cleanbox_circle_name{
    margin-right: 10px;
}
.cleanbox_circle2 .cleanbox_circle_name{
    margin-top: 1px;
} */
/* .card_padding_flex{
    display: flex;
}
.card_c{
    flex: 1;
}
.pm div{
    height: 90px;
    line-height: 90px;
}
.card_pm_name{
    width: 60px;
    text-align: right;
}
.card_pm_value{
    width: 90px;
    font-size: 24px;
    text-align: center;
}
.card_pm_flag{
    width: 50px;
}
.zt div{
    height: 65px;
    line-height: 65px;
}
.card_zt_name{
    width: 100px;
    padding-left: 10px;
} */
</style>